import sqlite3

conn = sqlite3.connect('../database.db')
conn.row_factory = sqlite3.Row

device_table_count = 806
for i in range(0, device_table_count):
    sql = 'CREATE TABLE IF NOT EXISTS "main"."gate_pass_info_device_{}" ("device" text(255), "gate_id" TEXT(255), "car_type" TEXT(255), "card_type" TEXT(255), "pass_timestamp" INTEGER, "location" TEXT(255), "card_tail" TEXT(255), "secret_card" TEXT(255))'.format(i)
    result = conn.execute(sql)
    print('create gate_pass_info_device_{}, affected row is {}'.format(i, result.rowcount))

conn.commit()